<?php


namespace App\Http\Repositories\Daos\Impls;


use App\Http\Repositories\Daos\IBrandDao;
use App\Http\Repositories\Eloquent\Brand;

class BrandDao extends BaseDao implements IBrandDao
{
    public function __construct(Brand $model)
    {
        parent::__construct($model);
    }

    public function getAll($search = [])
    {
        $filterMap = $this->model->newQuery();
        if (isset($search['parent_id']) && $search['parent_id'] !== '') {
            $filterMap->where('parent_id',$search['parent_id']);
        }
        $filterMap->where('is_deleted',0);
        return $filterMap->orderBy('first','asc')->orderBy('id','asc')->get();
    }

}